package nowCoder;

public class OddisOddOrEvenisEven {
	public void oddInOddEvenInEven(int[] arr) {
		
		int p = 0, cur = 0;
		while(cur<arr.length){
			if((arr[p] & 1)==1 && (p & 1)==0){
				for(;cur<arr.length && !((arr[cur] & 1)==0 && (cur & 1)==1);cur++);
				if(cur!=arr.length){
					int tmp = arr[p];
					arr[p] = arr[cur];
					arr[cur] = tmp;
					cur++;
				}
			}
			p++;
		}
	}
	
	public static void main(String[] args){
		OddisOddOrEvenisEven oddisOddOrEvenisEven = new OddisOddOrEvenisEven();
		int[] arr = {1,2}; 
		oddisOddOrEvenisEven.oddInOddEvenInEven(arr);
		for(Integer i:arr){
			System.out.println(i);
		}
	}
}
